        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>RevoluteJointDef class / box2d_html Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d_html" data-type="RevoluteJointDef">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d_html.html">box2d_html</a> &rsaquo; <a href="../box2d_html/RevoluteJointDef.html">RevoluteJointDef</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>RevoluteJointDef</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<p> Revolute joint definition. This requires defining an
 anchor point where the bodies are joined. The definition
 uses local anchor points so that the initial configuration
 can violate the constraint slightly. You also need to
 specify the initial relative angle for joint limits. This
 helps when saving and loading a game.
 The local anchor points are measured from the body's origin
 rather than the center of mass because...
 - You might not know where the center of mass will be.
 - If you add/remove shapes from a body and recompute the mass,
   the joints will be broken.</p>
<pre class="source">
class RevoluteJointDef extends JointDef {
  /**
   *  The local anchor point relative to body1's origin.
   */
  Vector localAnchorA;

  /**
   *  The local anchor point relative to body2's origin.
   */
  Vector localAnchorB;

  /**
   *  The body2 angle minus body1 angle in the reference state (radians).
   */
  num referenceAngle;

  /**
   *  A flag to enable joint limits.
   */
  bool enableLimit;

  /**
   *  The lower angle for the joint limit (radians).
   */
  num lowerAngle;

  /**
   *  The upper angle for the joint limit (radians).
   */
  num upperAngle;

  /**
   *  A flag to enable the joint motor.
   */
  bool enableMotor;

  /**
   *  The desired motor speed. Usually in radians per second.
   */
  num motorSpeed;

  /**
   *  The maximum motor torque used to achieve the desired motor speed.
   *  Usually in N-m.
   */
  num maxMotorTorque;

  RevoluteJointDef() :
    super(),
    localAnchorA = new Vector(0.0, 0.0),
    localAnchorB = new Vector(0.0, 0.0),
    referenceAngle = 0.0,
    lowerAngle = 0.0,
    upperAngle = 0.0,
    maxMotorTorque = 0.0,
    motorSpeed = 0.0,
    enableLimit = false,
    enableMotor = false {
    type = JointType.REVOLUTE;
  }

  /**
   * Initialize the bodies, anchors, and reference angle using the world
   * anchor.
   */
  void initialize(Body b1, Body b2, Vector anchor) {
    bodyA = b1;
    bodyB = b2;
    bodyA.getLocalPointToOut(anchor, localAnchorA);
    bodyB.getLocalPointToOut(anchor, localAnchorB);
    referenceAngle = bodyA.angle - bodyB.angle;
  }
}
</pre>
</div>
<h3>Extends</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../box2d_html/JointDef.html">JointDef</a></span>&nbsp;&gt;&nbsp;<span class="type-box"><span class="icon-class"></span><strong>RevoluteJointDef</strong></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="RevoluteJointDef">
<button class="show-code">Code</button>
new <strong>RevoluteJointDef</strong>() <a class="anchor-link" href="#RevoluteJointDef"
              title="Permalink to RevoluteJointDef.RevoluteJointDef">#</a></h4>
<div class="doc">
<pre class="source">
RevoluteJointDef() :
  super(),
  localAnchorA = new Vector(0.0, 0.0),
  localAnchorB = new Vector(0.0, 0.0),
  referenceAngle = 0.0,
  lowerAngle = 0.0,
  upperAngle = 0.0,
  maxMotorTorque = 0.0,
  motorSpeed = 0.0,
  enableLimit = false,
  enableMotor = false {
  type = JointType.REVOLUTE;
}
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field inherited"><h4 id="bodyA">
<button class="show-code">Code</button>
<a href="../box2d_html/Body.html">Body</a>         <strong>bodyA</strong> <a class="anchor-link"
            href="#bodyA"
            title="Permalink to RevoluteJointDef.bodyA">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<p>The first attached body.</p>
<pre class="source">
Body bodyA;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="bodyB">
<button class="show-code">Code</button>
<a href="../box2d_html/Body.html">Body</a>         <strong>bodyB</strong> <a class="anchor-link"
            href="#bodyB"
            title="Permalink to RevoluteJointDef.bodyB">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<p>The second attached body.</p>
<pre class="source">
Body bodyB;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="collideConnected">
<button class="show-code">Code</button>
bool         <strong>collideConnected</strong> <a class="anchor-link"
            href="#collideConnected"
            title="Permalink to RevoluteJointDef.collideConnected">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<p>Set this flag to true if the attached bodies should collide.</p>
<pre class="source">
bool collideConnected;
</pre>
</div>
</div>
<div class="field"><h4 id="enableLimit">
<button class="show-code">Code</button>
bool         <strong>enableLimit</strong> <a class="anchor-link"
            href="#enableLimit"
            title="Permalink to RevoluteJointDef.enableLimit">#</a>
        </h4>
        <div class="doc">
<p> A flag to enable joint limits.</p>
<pre class="source">
bool enableLimit;
</pre>
</div>
</div>
<div class="field"><h4 id="enableMotor">
<button class="show-code">Code</button>
bool         <strong>enableMotor</strong> <a class="anchor-link"
            href="#enableMotor"
            title="Permalink to RevoluteJointDef.enableMotor">#</a>
        </h4>
        <div class="doc">
<p> A flag to enable the joint motor.</p>
<pre class="source">
bool enableMotor;
</pre>
</div>
</div>
<div class="field"><h4 id="localAnchorA">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector.html">Vector</a>         <strong>localAnchorA</strong> <a class="anchor-link"
            href="#localAnchorA"
            title="Permalink to RevoluteJointDef.localAnchorA">#</a>
        </h4>
        <div class="doc">
<p> The local anchor point relative to body1's origin.</p>
<pre class="source">
Vector localAnchorA;
</pre>
</div>
</div>
<div class="field"><h4 id="localAnchorB">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector.html">Vector</a>         <strong>localAnchorB</strong> <a class="anchor-link"
            href="#localAnchorB"
            title="Permalink to RevoluteJointDef.localAnchorB">#</a>
        </h4>
        <div class="doc">
<p> The local anchor point relative to body2's origin.</p>
<pre class="source">
Vector localAnchorB;
</pre>
</div>
</div>
<div class="field"><h4 id="lowerAngle">
<button class="show-code">Code</button>
num         <strong>lowerAngle</strong> <a class="anchor-link"
            href="#lowerAngle"
            title="Permalink to RevoluteJointDef.lowerAngle">#</a>
        </h4>
        <div class="doc">
<p> The lower angle for the joint limit (radians).</p>
<pre class="source">
num lowerAngle;
</pre>
</div>
</div>
<div class="field"><h4 id="maxMotorTorque">
<button class="show-code">Code</button>
num         <strong>maxMotorTorque</strong> <a class="anchor-link"
            href="#maxMotorTorque"
            title="Permalink to RevoluteJointDef.maxMotorTorque">#</a>
        </h4>
        <div class="doc">
<p> The maximum motor torque used to achieve the desired motor speed.
 Usually in N-m.</p>
<pre class="source">
num maxMotorTorque;
</pre>
</div>
</div>
<div class="field"><h4 id="motorSpeed">
<button class="show-code">Code</button>
num         <strong>motorSpeed</strong> <a class="anchor-link"
            href="#motorSpeed"
            title="Permalink to RevoluteJointDef.motorSpeed">#</a>
        </h4>
        <div class="doc">
<p> The desired motor speed. Usually in radians per second.</p>
<pre class="source">
num motorSpeed;
</pre>
</div>
</div>
<div class="field"><h4 id="referenceAngle">
<button class="show-code">Code</button>
num         <strong>referenceAngle</strong> <a class="anchor-link"
            href="#referenceAngle"
            title="Permalink to RevoluteJointDef.referenceAngle">#</a>
        </h4>
        <div class="doc">
<p> The body2 angle minus body1 angle in the reference state (radians).</p>
<pre class="source">
num referenceAngle;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="runtimeType">
<button class="show-code">Code</button>
final Type         <strong>runtimeType</strong> <a class="anchor-link"
            href="#runtimeType"
            title="Permalink to RevoluteJointDef.runtimeType">#</a>
        </h4>
        <div class="inherited-from">inherited from Object </div><div class="doc">
<p>A representation of the runtime type of the object.</p>
<pre class="source">
external Type get runtimeType;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="type">
<button class="show-code">Code</button>
int         <strong>type</strong> <a class="anchor-link"
            href="#type"
            title="Permalink to RevoluteJointDef.type">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<p>The joint type is set automatically for concrete joint types.</p>
<pre class="source">
int type;
</pre>
</div>
</div>
<div class="field"><h4 id="upperAngle">
<button class="show-code">Code</button>
num         <strong>upperAngle</strong> <a class="anchor-link"
            href="#upperAngle"
            title="Permalink to RevoluteJointDef.upperAngle">#</a>
        </h4>
        <div class="doc">
<p> The upper angle for the joint limit (radians).</p>
<pre class="source">
num upperAngle;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="userData">
<button class="show-code">Code</button>
Object         <strong>userData</strong> <a class="anchor-link"
            href="#userData"
            title="Permalink to RevoluteJointDef.userData">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<p>Use this to attach application specific data to your joints.</p>
<pre class="source">
Object userData;
</pre>
</div>
</div>
</div>
<div>
<h3>Operators</h3>
<div class="method inherited"><h4 id="==">
<button class="show-code">Code</button>
bool <strong>operator ==</strong>(other) <a class="anchor-link" href="#=="
              title="Permalink to RevoluteJointDef.operator ==">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>The equality operator.</p>
<p>The default behavior for all <code>Object</code>s is to return true if and
only if <code>this</code> and 
<span class="param">other</span> are the same object.</p>
<p>If a subclass overrides the equality operator it should override
the <code>hashCode</code> method as well to maintain consistency.</p>
<pre class="source">
bool operator ==(other) =&gt; identical(this, other);
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method inherited"><h4 id="hashCode">
<button class="show-code">Code</button>
int <strong>hashCode</strong>() <a class="anchor-link" href="#hashCode"
              title="Permalink to RevoluteJointDef.hashCode">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Get a hash code for this object.</p>
<p>All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator <code>==</code>. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.</p>
<p>If a subclass overrides <code>hashCode</code> it should override the
equality operator as well to maintain consistency.</p>
<pre class="source">
external int hashCode();
</pre>
</div>
</div>
<div class="method"><h4 id="initialize">
<button class="show-code">Code</button>
void <strong>initialize</strong>(<a href="../box2d_html/Body.html">Body</a> b1, <a href="../box2d_html/Body.html">Body</a> b2, <a href="../box2d_html/Vector.html">Vector</a> anchor) <a class="anchor-link" href="#initialize"
              title="Permalink to RevoluteJointDef.initialize">#</a></h4>
<div class="doc">
<p>Initialize the bodies, anchors, and reference angle using the world
anchor.</p>
<pre class="source">
void initialize(Body b1, Body b2, Vector anchor) {
  bodyA = b1;
  bodyB = b2;
  bodyA.getLocalPointToOut(anchor, localAnchorA);
  bodyB.getLocalPointToOut(anchor, localAnchorB);
  referenceAngle = bodyA.angle - bodyB.angle;
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="JointDef">
<button class="show-code">Code</button>
new <strong>JointDef</strong>() <a class="anchor-link" href="#JointDef"
              title="Permalink to RevoluteJointDef.JointDef">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d_html/JointDef.html">JointDef</a> </div><div class="doc">
<pre class="source">
JointDef() :
  type = JointType.UNKNOWN,
  userData = null,
  bodyA = null,
  bodyB = null,
  collideConnected = false { }
</pre>
</div>
</div>
<div class="method inherited"><h4 id="noSuchMethod">
<button class="show-code">Code</button>
<strong>noSuchMethod</strong>(String name, List args) <a class="anchor-link" href="#noSuchMethod"
              title="Permalink to RevoluteJointDef.noSuchMethod">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p><code>noSuchMethod</code> is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to <code>noSuchMethod</code>. If <code>noSuchMethod</code>
returns a value, that value becomes the result of the original
invocation.</p>
<p>The default behavior of <code>noSuchMethod</code> is to throw a
<code>noSuchMethodError</code>.</p>
<pre class="source">
external Dynamic noSuchMethod(String name, List args);
</pre>
</div>
</div>
<div class="method inherited"><h4 id="Object">
<button class="show-code">Code</button>
const <strong>Object</strong>() <a class="anchor-link" href="#Object"
              title="Permalink to RevoluteJointDef.Object">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Creates a new <code>Object</code> instance.</p>
<p><code>Object</code> instances have no meaningful state, and are only useful
through their identity. An <code>Object</code> instance is equal to itself
only.</p>
<pre class="source">
const Object();
</pre>
</div>
</div>
<div class="method"><h4 id="RevoluteJointDef">
<button class="show-code">Code</button>
new <strong>RevoluteJointDef</strong>() <a class="anchor-link" href="#RevoluteJointDef"
              title="Permalink to RevoluteJointDef.RevoluteJointDef">#</a></h4>
<div class="doc">
<pre class="source">
RevoluteJointDef() :
  super(),
  localAnchorA = new Vector(0.0, 0.0),
  localAnchorB = new Vector(0.0, 0.0),
  referenceAngle = 0.0,
  lowerAngle = 0.0,
  upperAngle = 0.0,
  maxMotorTorque = 0.0,
  motorSpeed = 0.0,
  enableLimit = false,
  enableMotor = false {
  type = JointType.REVOLUTE;
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="toString">
<button class="show-code">Code</button>
String <strong>toString</strong>() <a class="anchor-link" href="#toString"
              title="Permalink to RevoluteJointDef.toString">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Returns a string representation of this object.</p>
<pre class="source">
external String toString();
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
